Boxplots: Comparison across subjects

# last away ~ lives
merged_data %>%
  select(lives, last_away, subject_id) %>%
  distinct() %>%
  ggplot(., aes(x = factor(lives), y = last_away, fill = factor(lives))) +
  geom_boxplot(notch = T) +
  theme(panel.background = element_rect(fill = "white"),
        legend.position = "none") +
  labs(x = "Lives", y = "Distance to Ghost at Turnaround", fill = "Lives", title = "Turn Around Distance By Number of Remaining Lives", subtitle = "Subjects stayed farther away from the ghost when they only had one life remaining")

# last away ~ rewardgroup
merged_data %>%
  select(rewardgroup, last_away, subject_id) %>%
  distinct() %>%
  ggplot(., aes(x = factor(rewardgroup), y = last_away, fill = factor(rewardgroup))) +
  geom_boxplot(notch = T) +
  theme(panel.background = element_rect(fill = "white"),
        legend.position = "none") +
  labs(x = "rewardgroup", y = "Distance to Ghost at Turnaround", fill = "Rewardgroup", title = "Turn Around Distance By rewardgroups", subtitle = "Subjects moved closer to the ghost when there was a large reward \nin the last position (w/o ghost overlap)")

New Visualisations

Notes:
- filter picks 16-20 subjects
- subject 49,33,36 never 1 life?

to-do:
- interpretations

Regression Lines

random sample, individual + combined plots
- lives –> last away
- rewardgroup –> last away
- score –> last away

Individual Plots

lives_ind

rewardgroup_ind

score_ind

#rm(lives_ind, rewardgroup_ind, score_ind)

Combined Plots

plot_comb <- lives_comb/rewardgroup_comb/score_comb
plot_comb

#rm(lives_comb, rewardgroup_comb, score_comb, plot_comb)

Random Effects

with random subsample for rewardgroup, lives and score

note:
- difference between plots in No RE ≠ 0
–> due to different calculations / package inconsistency (plot_model)?
–> verify with other functions (e.g. dotplot(ranef(model, condVar = TRUE)))

to-do:
- header e.g. which model
- interpretations
- verification differences RE outputs

print("Reward Model")
## [1] "Reward Model"
reward_RE <- plot_model(model.reward.random.noanxiety,type="re", grid.breaks = 10)
## Warning in checkMatrixPackageVersion(): Package version inconsistency detected.
## TMB was built with Matrix version 1.5.4.1
## Current Matrix version is 1.4.1
## Please re-install 'TMB' from source using install.packages('TMB', type = 'source') or ask CRAN for a binary version of 'TMB' matching CRAN's 'Matrix' package
## Warning in checkDepPackageVersion(dep_pkg = "TMB"): Package version inconsistency detected.
## glmmTMB was built with TMB version 1.9.3
## Current TMB version is 1.9.6
## Please re-install glmmTMB from source or restore original 'TMB' package (see '?reinstalling' for more information)
reward_RE  # + theme_sjplot() #white background etc
## Warning: Removed 1 rows containing missing values (`geom_point()`).

reward_RE_sorted <- plot_model(model.reward.random.noanxiety,type="re", sort.est = T, grid=F)
reward_RE_sorted
## [[1]]

## 
## [[2]]

print("Loss Model")
## [1] "Loss Model"
loss_RE <- plot_model(model.loss.random.noanxiety,type="re")
loss_RE

loss_RE_sorted <- plot_model(model.loss.random.noanxiety,type="re", sort.est = T, grid=F)
loss_RE_sorted
## [[1]]

## 
## [[2]]

print("Extensive Model")
## [1] "Extensive Model"
extensive_RE <- plot_model(model.extensive.random1.noanxiety,type="re", grid.breaks = 5, grid=T)
extensive_RE

extensive_RE_sorted <- plot_model(model.extensive.random1.noanxiety,type="re", sort.est = T, grid=F)
extensive_RE_sorted
## [[1]]

## 
## [[2]]

reward_verification <- dotplot(ranef(model.extensive.random1.noanxiety, condVar = TRUE))
reward_verification
## $subject_id

Diagnostics2

method: plot_model(model,type=“diag”)

print("Reward Model")
## [1] "Reward Model"
reward_diagnostic <- plot_model(model.reward.random.noanxiety,type="diag",
       terms=c("rewardgroup","subject_id"))
reward_diagnostic 
## [[1]]

## 
## [[2]]
## [[2]]$subject_id

## 
## 
## [[3]]

## 
## [[4]]

print("Loss Model")
## [1] "Loss Model"
loss_diagnostic <- plot_model(model.loss.random.noanxiety,type="diag",
       terms=c("lives","subject_id"))
loss_diagnostic
## [[1]]

## 
## [[2]]
## [[2]]$subject_id

## 
## 
## [[3]]

## 
## [[4]]

print("Extensive Model")
## [1] "Extensive Model"
extensive_diagnostic <- plot_model(model.extensive.random1.noanxiety,type="diag",
       terms=c("rewardgroup","lives", "subject_id"))
extensive_diagnostic
## [[1]]

## 
## [[2]]
## [[2]]$subject_id

## 
## 
## [[3]]

## 
## [[4]]